package Aaaaaa;

import java.util.Arrays;
import java.util.Scanner;

public class Main4 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int m=sc.nextInt();
        int x=sc.nextInt();
        int k=sc.nextInt();
        int[] arr=new int[n];
        for(int i=0;i<n;i++){
            arr[i]=sc.nextInt();
        }
        int[] res=new int[n];
        int[] mmm=new int[100];
        int min=Integer.MAX_VALUE;
        int  index=0;
        for(int i=0;i<n;i++){
            for(int j=i;j<n;j++){
                for(int p=0;p<n;p++){
                    if(Math.abs(p-i)<=x&&Math.abs(p-j)<=x){
                        res[p]=arr[p]+2*k;
                    }else if(Math.abs(p-i)<=x){
                        res[p]=arr[p]+k;
                    }else if(Math.abs(p-j)<=x){
                        res[p]=arr[p]+k;
                    }else{
                        res[p]=arr[p];
                    }
                }
                for (int re : res) {
                    min=Math.min(re,min);
                }
                mmm[index++]=min;
            }
        }
        System.out.println(Arrays.toString(res));
        int max=Integer.MIN_VALUE;
        for (int i : mmm) {
            max=Math.max(max,i);
        }

        System.out.println(max);
    }
}
